import { App } from 'vue';
import { use } from 'echarts/core';
import { CanvasRenderer } from 'echarts/renderers';
import { BarChart, LineChart, PieChart, RadarChart } from 'echarts/charts';
import {
  GridComponent,
  TooltipComponent,
  LegendComponent,
  DataZoomComponent,
  GraphicComponent,
} from 'echarts/components';
import { Icon } from '@arco-design/web-vue';
import Chart from './chart/index.vue';
import Breadcrumb from './breadcrumb/index.vue';
import xTable from './table/index.vue';
import tableSearch from './table-search/index.vue';
import dictTag from './dict-tag/index.vue';
import editModel from './editModal/index.vue';
import form from './form/index.vue';
import editor from './editor/index.vue';
import dataTree from './data-tree/index.vue';
import deptTreeSearch from './dept-tree-search/index.vue';
import importBox from './import-box/index.vue';
import upload from './upload/index.vue';
import excelTable from './excel-table/index.vue';

const IconFont = Icon.addFromIconFontCn({
  src: '../../src/assets/iconfont/iconfont.js',
});
// Manually introduce ECharts modules to reduce packing size

use([
  CanvasRenderer,
  BarChart,
  LineChart,
  PieChart,
  RadarChart,
  GridComponent,
  TooltipComponent,
  LegendComponent,
  DataZoomComponent,
  GraphicComponent,
]);

export default {
  install(Vue: App) {
    Vue.component('Chart', Chart);
    Vue.component('Breadcrumb', Breadcrumb);
    Vue.component('XTable', xTable);
    Vue.component('TableSearch', tableSearch);
    Vue.component('DictTag', dictTag);
    Vue.component('EditModal', editModel);
    Vue.component('XForm', form);
    Vue.component('Editor', editor);
    Vue.component('DataTree', dataTree);
    Vue.component('DeptTreeSearch', deptTreeSearch);
    Vue.component('ImportBox', importBox);
    Vue.component('XUpload', upload);
    Vue.component('ExcelTable', excelTable);
    Vue.component('IconFont', IconFont);
  },
};
